<template>
  <div>
    <div class="form">
      <div class="search">
        <el-input placeholder="客户编号" v-model="workCode" class="search_info">
          <i slot="prefix" class="el-input__icon el-icon-search"></i>
        </el-input>
        <el-select v-model="workStatus" placeholder="区域" class="search_info">
          <el-option
            v-for="item in status"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
        <el-select v-model="workStatus" placeholder="行业" class="search_info">
          <el-option
            v-for="item in status"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
        <el-input placeholder="统一社会编码" v-model="workCode" class="search_info">
        </el-input>
        <el-input placeholder="法定代表人" v-model="workCode" class="search_info">
        </el-input>
        <div class="pos_right_btn">
          <el-button type="primary" @click="getList(1)" class="searchBtn">搜索</el-button>
        </div>
      </div>
      <el-table
        class="listTable"
        v-loading="listLoading"
        :data="list"
        border
        fit
        highlight-current-row
        style="width: 100%;"
      >
        <el-table-column label="客户编号" prop="id" width="100"  align="center">
          <template slot-scope="{row}">
            <span>{{ row.deptId }}</span>
          </template>
        </el-table-column>
        <el-table-column label="客户名称">
          <template slot-scope="{row}">
            <span>{{ row.nickName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="区域" align="center">
          <template slot-scope="{row}">
            <span>{{ row.remark }}</span>
          </template>
        </el-table-column>
        <el-table-column label="行业" width="160" align="center">
          <template slot-scope="{row}">
            <span>{{ row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
          </template>
        </el-table-column>
        <!-- <el-table-column label="授信额度" align="center">
          <template slot-scope="{row}">
            <span>{{ row.createBy }}</span>
          </template>
        </el-table-column> -->
        <el-table-column label="统一社会编码" align="center">
          <template slot-scope="{row}">
            <span>{{ row.phonenumber }}</span>
          </template>
        </el-table-column>
        <el-table-column label="法定代表人" width="100" align="center">
          <template slot-scope="{row}">
            <span :class="{'res_color': row.taskStatus == 2}">{{ row.remark }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="60" align="center">
          <template slot-scope="{row,$index}" class="opt_table">
            <span class="opt_font" @click="preview(row.id)">详情</span>
          </template>
        </el-table-column>
      </el-table>

      <el-pagination 
      :total="total" 
      layout="total, sizes, prev, pager, next" 
      :page-size="limit" 
      :page-sizes="[10, 20, 50, 100]" 
      @size-change="handleSizeChange"
      :current-page.sync="curPage" 
      @current-change="getList($event)" 
      class="sortStyle"/>
      <el-dialog :visible.sync="detailShow" title="测试" width="1096px">
        <div class="tab">
          <div class="tab_border">
            关联图谱
          </div>
          <div class="tab_border">
            信用报告
          </div>
          <div class="tab_border">
            信用分
          </div>
          <div class="tab_border change">
            黑名单
          </div>
        </div>
        
        <div>
          <div class="detail_title">
            <span></span>
            企业基本信息
          </div>
          <div class="detail_info">
            <div class="row">
              <div class="info_left">
                <div class="info_left_title">企业名称</div>
                <div class="info_left_content">{{listData.enterCode}}</div>
              </div>
              <div class="info_right">
                <div class="info_left_title">统一社会信用代码</div>
                <div class="info_left_content">{{listData.comIndustry}}</div>
              </div>
            </div>
            <div class="row">
              <div class="info_left">
                <div class="info_left_title">企业类型</div>
                <div class="info_left_content">{{listData.comType}}</div>
              </div>
              <div class="info_right">
                <div class="info_left_title">经营状态</div>
                <div class="info_left_content">{{listData.isTechno}}</div>
              </div>
            </div>
            <div class="row">
              <div class="info_left">
                <div class="info_left_title">所属行业</div>
                <div class="info_left_content">{{listData.employ}}</div>
              </div>
              <div class="info_right">
                <div class="info_left_title">成立时间</div>
                <div class="info_left_content">{{listData.isForeign}}</div>
              </div>
            </div>
            <div class="row">
              <div class="info_left">
                <div class="info_left_title">公司类型</div>
                <div class="info_left_content">{{listData.regTime}}</div>
              </div>
              <div class="info_right">
                <div class="info_left_title">法定代表人</div>
                <div class="info_left_content">{{listData.city}}</div>
              </div>
            </div>
            <div class="row">
              <div class="info_left">
                <div class="info_left_title">发照日期</div>
                <div class="info_left_content">{{listData.contName}}</div>
              </div>
              <div class="info_right">
                <div class="info_left_title">企业地址</div>
                <div class="info_left_content">{{listData.contPhone}}</div>
              </div>
            </div>
            <div class="row">
              <div class="info_left">
                <div class="info_left_title">注册资本(万元)</div>
                <div class="info_left_content">{{listData.contName}}</div>
              </div>
              <div class="info_right">
                <div class="info_left_title">行政区划</div>
                <div class="info_left_content">{{listData.contPhone}}</div>
              </div>
            </div>
            <div class="row">
              <div class="info_left">
                <div class="info_left_title">经营范围</div>
                <div class="info_left_content">{{listData.contName}}</div>
              </div>
            </div>
          </div>
          <div class="detail_title pos_top">
            <span></span>
            需求表
          </div>
          <el-table
            class="detailTable"
            v-loading="listLoading"
            :data="lastYearData"
            border
            fit
            highlight-current-row
            style="width: 100%;"
          >
            <el-table-column label="业务编号" prop="id" align="center">
              <template slot-scope="{row}">
                <span>{{ row.lastFixCost }}</span>
              </template>
            </el-table-column>
            <el-table-column label="发布时间" align="center">
              <template slot-scope="{row}">
                <span>{{ row.lastIncome }}</span>
              </template>
            </el-table-column>
            <el-table-column label="产品名称" align="center">
              <template slot-scope="{row}">
                <span>{{ row.lastTax }}</span>
              </template>
            </el-table-column>
            <el-table-column label="融资金额(万元)" align="center">
              <template slot-scope="{row}">
                <span>{{ row.lastTax }}</span>
              </template>
            </el-table-column>
            <el-table-column label="融资期限" align="center">
              <template slot-scope="{row}">
                <span>{{ row.lastTax }}</span>
              </template>
            </el-table-column>
            <el-table-column label="担保方式" align="center">
              <template slot-scope="{row}">
                <span>{{ row.lastTax }}</span>
              </template>
            </el-table-column>
          </el-table>
          <div class="detail_title pos_top">
            <span></span>
            授信表
          </div>
          <el-table
            class="detailTable"
            v-loading="listLoading"
            :data="loanList"
            border
            fit
            highlight-current-row
            style="width: 100%;"
          >
            <el-table-column label="业务编号" prop="id" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanOrg }}</span>
              </template>
            </el-table-column>
            <el-table-column label="审核时间" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanMoney }}</span>
              </template>
            </el-table-column>
            <el-table-column label="产品名称" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanTime }}</span>
              </template>
            </el-table-column>
            <el-table-column label="授信额度" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanPurpose }}</span>
              </template>
            </el-table-column>
            <el-table-column label="授信时间" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanPurpose }}</span>
              </template>
            </el-table-column>
            <el-table-column label="担保方式" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanPurpose }}</span>
              </template>
            </el-table-column>
          </el-table>
          <div class="detail_title pos_top">
            <span></span>
            放款表
          </div>
          <el-table
            class="detailTable"
            v-loading="listLoading"
            :data="orgList"
            border
            fit
            highlight-current-row
            style="width: 100%;"
          >
            <el-table-column label="业务编号" prop="id" align="center">
              <template slot-scope="{row}">
                <span>{{ row.finOrgan }}</span>
              </template>
            </el-table-column>
            <el-table-column label="授信开始时间" align="center">
              <template slot-scope="{row}">
                <span>{{ row.creditAmount }}</span>
              </template>
            </el-table-column>
            <el-table-column label="授信结束时间" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanTime }}</span>
              </template>
            </el-table-column>
            <el-table-column label="产品名称" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanPurpose }}</span>
              </template>
            </el-table-column>
            <el-table-column label="授信金额" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanPurpose }}</span>
              </template>
            </el-table-column>
            <el-table-column label="贷款余额" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanPurpose }}</span>
              </template>
            </el-table-column>
            <el-table-column label="担保方式" align="center">
              <template slot-scope="{row}">
                <span>{{ row.loanPurpose }}</span>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="backBtn">
          <el-button @click="goback">返回</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import { listUser } from "@/api/system/user";
import { allBatchDelete, batchDelete, allSubmit, submit, creatWork, getRecieveList, getList, cancelOpt, listPreview, audit, overUdit, listPreviewCity, downLoadExampel, upLoadExampel, companyPreview } from '@/api/article'
import { MessageBox } from 'element-ui'
export default {
  components: {
   
  },
  data() {
    return {
      workCode: '',
      workStatus: '',
      status: [], 
      list: [],
      listLoading: false,
      total: 0,
      limit: 10,
      curPage: 1,
      listData: [],
      detailShow: false,

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
        deptId: undefined
      },
      // 日期范围
      dateRange: [],
      // 总条数
      total: 0,
      // 用户表格数据
      userList: null,
    }
  },
  created() {
    
  },
  mounted(){
    // this.getList(1)
    this.getList(1);
  },
  methods: {
    /** 查询用户列表 */
    getList(page) {
      // var params = {
      //   page: page,
      //   size: this.limit,
      //   taskName : this.workName,
      //   taskNo : this.workCode,
      //   status: this.workStatus,
      // }
      // if (this.workStartTime) {
      //   params.startDate = this.formdate(this.workStartTime)
      // }
      // if (this.workEndTime) {
      //   params.endDate = this.formdate(this.workEndTime)
      // }
      this.listLoading = true
      listUser().then(response => {
          this.list = response.rows;
          this.total = response.total;
          this.listLoading = false;
        }
      );
    },
    goback() {
      this.detailShow = false
    },
    handleSizeChange(val) {
      this.limit = val
      this.getList(1)
    },
    //任务详情
    preview(id) {
      this.detailShow = true
    },
    //企业名单列表
    // getList(page) {
    //   var params = {
    //       page: page,
    //       size: this.limit,
    //       taskName : this.workName,
    //       taskNo : this.workCode,
    //       status: this.workStatus,
    //     }
    //   if (this.workStartTime) {
    //     params.startDate = this.formdate(this.workStartTime)
    //   }
    //   if (this.workEndTime) {
    //     params.endDate = this.formdate(this.workEndTime)
    //   }
    //   this.listLoading = true
    //   getList(params).then(res => {
    //     this.listLoading = false
    //     if (res.code == 200) {
    //       this.list = res.data.list
    //       this.total = res.data.total
    //       this.list.forEach(element => {
    //         if (this.roleId == '001009') {
    //           switch (element.taskStatus) {
    //             case '1':
    //               element.taskStatu = '名单上报中'
    //               break;
    //             case '2':
    //               element.taskStatu = '名单审核中'
    //               break;
    //             case '3':
    //               element.taskStatu = '名单已分发'
    //               break; 
    //             case '4':
    //               element.taskStatu = '已撤销'
    //               break; 
    //           }
    //         } else {
    //           if (element.taskStatus == '2') {
    //             element.taskStatu = '未处理'
    //           } else {
    //             element.taskStatu = '已处理'
    //           }
    //         }
    //       });
    //     } else {
    //       this.$message({message: res.msg,type: 'error'})
    //     }
    //   })
    // },
  }
}
</script>
<style scoped>
  .form {
    padding-left: 26px;
    padding-right: 24px;
    padding-top: 24px;
    background: #fff;
  }
  .search {
    display: flex;
    position: relative;
  }
  .search_info {
    width: 192px;
    height: 40px;
    margin-right: 16px;
  }
  .searchBtn {
    margin-left: 16px;
    height: 36px;
  }
  .sortStyle {
    height: 19px;
    float: right;
    /* right: 24px; */
    margin-top: 20px;
    margin-bottom: 30px;
  }
  .pos_right_btn {
    position: absolute;
    right: 0;
  }
  .opt_font {
    cursor: pointer;
    color: #2e82ff;
  }
 .detail_title {
    font-size: 16px;
    font-weight: 400;
    color: #212121;
    line-height: 22px;
  }
  .detail_title span {
    padding-left: 4px;
    background: #1e88e5;
    margin-right: 12px;
  }
  .row {
    display: flex;
    padding-bottom: 12px;
  }
  .detail_info {
    padding-top: 16px;
  }
  .info_left {
    display:flex;
  }
  .info_right {
    display: flex;
    padding-left: 202px;
  }
  .info_left_title {
    font-size: 14px;
    font-weight: 400;
    color: #616161;
    line-height: 20px;
    width: 112px;
    margin-right: 16px;
  }
  .info_left_content {
    font-size: 14px;
    font-weight: 400;
    color: #212121;
    line-height: 20px;
    width: 150px;
  }
  .pos_top {
    padding-top: 12px;
  }
  .detailTable {
    margin-top: 16px;
  }
  .opt_font {
    color: #1e88e5;
    cursor: pointer;
  }
  .page_pos {
    text-align: right;
    padding-top: 10px;
  }
  .backBtn {
    text-align: center;
    margin-top:10px;
  }
  /deep/ .el-dialog {
    display: flex;
    flex-direction: column;
    margin:0 !important;
    position: absolute;
    top:50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-height: calc(100% -30px);
    /* max-width: ; */
  }
  /deep/ .el-dialog .el-dialog__body {
    flex: 1;
    height: 700px;
    overflow-y: auto;
    padding-top: 0;
  }
  .tab {
    display: flex;
    position: absolute;
    right: 32px;
    top:14px;
  }
  .tab_border {
    border: 1px solid #409EFF;
    color: #409EFF;
    padding:10px 12px;
    font-size: 14px;
    margin-right: 16px;
  }
  .change {
    border: 1px solid #F56C6C;
    color: #F56C6C;
  }
  .listTable {
    margin-top: 17px;
  }
</style>
